#ifndef _BURST_OS_H
#define _BURST_OS_H

#define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE 1

#ifdef __GNUC__
#include <netdb.h>
#include <sys/socket.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#endif

#ifdef _MSC_VER
#include <winsock2.h>
#endif

typedef int bus_io_init_t();
typedef int bus_socket_t(int, int, int);
typedef int bus_set_non_block_io_t(int, int);
typedef int bus_connect_t(int, struct sockaddr *, int);
typedef int bus_bind_t(int, struct sockaddr *, int);
typedef int bus_listen_t(int, int);
typedef int bus_accept_t(int, struct sockaddr *, int *);
typedef int bus_send_t(int, char *, int, int);
typedef int bus_recv_t(int, char *, int, int);

typedef int bus_open_t(char *, int); 
typedef int bus_read_t(int, void *, u_int);
typedef int bus_write_t(int, void *, u_int);
typedef s64 bus_lseek64_t(int, s64, int);

typedef struct bus_io {
	bus_module_desc_t *info;		/* Module info */

	bus_io_init_t *init;			/* IO initializer */

	bus_socket_t *socket;			/* socket() */
	bus_set_non_block_io_t *set_non_block;	/* set_non_block() */
	bus_connect_t *connect;			/* connect() */
	bus_bind_t *bind;			/* bind() */
	bus_listen_t *listen;			/* listen() */
	bus_accept_t *accept;			/* accept() */
	bus_send_t *send;			/* send() */
	bus_recv_t *recv;			/* recv() */

	bus_open_t *open;			/* open() */
	bus_lseek64_t *lseek64;			/* lseek64() */
	bus_read_t *read;			/* read() */
	bus_write_t *write;			/* write() */

	struct rb_node node;
} bus_io_t;

#endif